home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cit.arc
/
CTDL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1986-01-10
|
16KB
|
449 lines
/************************************************************************/
/* Ctdl.h */
/* #include file for all Citadel C files. */
/* Now includes only #defines and structs. */
/************************************************************************/
#define _C86_BIG 1
#include "stdio.h"
/************************************************************************/
/* 85Oct16 HAW Add code for OFFICE-STUFF parameter. */
/* 85Aug29 HAW Install code to allow double msg files for autobackup. */
/* 85Jun19 HAW Implant exit values so batch files can be made useful. */
/* 85May27 HAW Start adding networking gunk. */
/* 85May22 HAW MAXLOGTAB now sysop selectable. */
/* 85May06 HAW Add daily bailout parameter. */
/* 85May05 HAW Add SYSDISK parameter. */
/* 85Mar20 HAW Add timestamp code. */
/* 85Feb21 HAW Add directory names. */
/* 85Feb20 HAW Implement IMPERVIOUS flag. */
/* 85Feb18 HAW Insert global variables for baud search. */
/* 85Jan20 HAW Insert code to read from system clock. */
/* 84Aug30 HAW Begin conversion to MS-DOS */
/* */
/* #defines 82Dec10 dvm */
/* */
/* #defs supported in current system: */
/* */
/* #def FDC-1 for the TeleTek (dvm code) */
/* #def VFC-2 for the Big Board (dvm code) */
/* */
/* #def TEST for special small-scale test version */
/************************************************************************/
#define ulong unsigned long /* Makes it easier to format */
#define MSDOS 1
#define NAMESIZE 20 /* length of room names */
typedef char label[NAMESIZE];
/* Citadel programs use readSysTab() and writeSysTab() to write an */
/* image of the external variables in RAM to disk, and later restore */
/* it. The image is stored in ctdlTabl.sys . If ctdlTabl.sys is lost, */
/* confg.com will automatically reconstruct the hard way when invoked, */
/* and write a new ctdlTabl.sys out when finished. CtdlTabl.sys is */
/* always destroyed after reading, to minimize the possibility of */
/* reading an out-of-date version. In general, the technique works */
/* well and saves time and head-banging on bootup. You should, */
/* however, note carefully the following caution: */
/* o Whenever you change the declarations in Ctdl.h you should: */
/* --> destroy the current ctdlTabl.sys file */
/* --> recompile and reload all citadel programs which access */
/* ctdlTabl.sys -- currently citadel.com & configur.com */
/* --> use configur.com to build a new ctdlTabl.sys file */
/* */
/* If you ignore these warnings, little pixies will prick you in your */
/* sleep for the rest of your life. */
/************************************************************************/
/* Let's begin by defining the configuration struct. */
/* This is part of the contents of ctdltabl.sys */
struct config {
char firstExtern;
unsigned maxMSector; /* Max # of sectors (simulated) */
char megaHz; /* 8088 clock rate (for wait loops) */
ulong oldest; /* 32-bit ID# of first message in system*/
ulong newest; /* 32-bit ID# of last message in system*/
int nodeName; /* Offsets in codeBuf */
int nodeTitle;
int nodeId;
int bRoom;
int officeStuff;
char noChat; /* TRUE to suppress chat attempts */
int cryptSeed;
#ifndef MSDOS
char clock; /* TRUE if we have a hardware clock */
#endif
char search_baud; /* TRUE to do flip flop search for baud */
char IBM_or_clone; /* Specialize for Sperry PC <sigh> */
char dailyTimeout; /* Do we want to bail out on a daily */
int hourOut; /* basis? When? */
char call_log; /* if < 100, indicates drive for log */
char mirror; /* Auto backup of message files? */
char mbkpDisk; /* Where is this file located? */
char filter[128]; /* input character translation table */
char homeDisk, msgDisk, sysDisk;/* where we keep our data files */
char netDisk; /* where we want to find net files */
char ourDisk; /* where we are just now */
char ourUser[10];
char unlogEnterOk; /* TRUE if OK to enter messages anon */
char unlogReadOk; /* TRUE if unlogged folks can read mess */
char unlogLoginOk; /* TRUE if spontan. new accounts ok. */
char nonAideRoomOk; /* TRUE general folks can make rooms */
char noMail; /* TRUE if mail is not allowed */
char sysBaud;
char netParticipant; /* TRUE if participating in the net */
char longHaul; /* TRUE if willing to do long distance */
char dayDiv; /* Days to network on */
char netHour; /* Hour to start networking on */
char netLength; /* Length of networking */
int netSize;
/* stuff to distinguish the various Citadel programs */
#define CITADEL 0 /* principal program */
#define xxxxx 1 /* unused */
#define NET 2 /* network downloader */
#define ARCHIVE 3 /* backup program (future) */
#define CONFIGUR 4
#define UTILITY 5
char weAre; /* set first thing by main() */
int paramVers;
/* Stuff to size system with: */
/* WARNING!!! if you expand MAXROOMS beyond 128, horrible, horrible */
/* things will happen to the userlog entries, which will no longer */
/* fit in the assigned 256-byte records and will overwrite things */
/* with normally undesirable results. 82Nov10CrT */
#define MAXROOMS 64 /* number of rooms allowed in system */
int MAXLOGTAB; /* number of log entries supported */
/* Stuff nowadays usually in bdscio.h: */
/* values for functions to return: */
#define TRUE 1
#define FALSE 0
#define ERROR -1
#define SAMESTRING 0 /* value for strcmp() & friend */
/* ASCII characters: */
#define SOH 1
#define CNTRLC 3
#define EOT 4
#define ACK 6
#define BELL 7
#define BACKSPACE 8
#define CNTRLI 9 /* aka tab */
#define TAB 9 /* aka ^I */
#define NEWLINE 10 /* "linefeed" to philistines. */
#define CNTRLO 15
#define CNTRLl 12 /* Sysop privileges */
#define XOFF 19 /* control-s */
#define NAK 21
#define CAN 24
#define CNTRLZ 26
#define CPMEOF CNTRLZ
#define ESC 27 /* altmode */
#define DEL 0x7F /* delete char */
/* Stuff for rooms: */
#define LOBBY 0 /* Lobby> is >always< room 0. */
#define MAILROOM 1 /* Mail> is >always< room 1. */
#define AIDEROOM 2 /* Aide> is >always< room 2. */
#ifdef TEST
#define MSGSPERRM 58 /* should be >= MAILSLOTS */
#else
#define MSGSPERRM 58 /* roombuf must be 256 bytes or less. */
#endif
#define SECTSIZE 128
#define MAXCODE 512
unsigned char codeBuf[MAXCODE];/* buffer for configuration routines */
unsigned char scratch[40]; /* scratch space for config routines */
unsigned char shave[8]; /* shave-and-a-haircut/2 bits pauses */
/* routine offsets in codeBuf: */
int pBauds[3]; /* Indexes into here defined later */
int pHangUp, pCarrDetect, pMIReady, pMOReady, pInitPort;
int pCheckBaud;
#ifndef MSDOS /* MSDOS has and uses system clock, so if using */
/* it, don't need this stuff. */
int pInitDate, pGetDay, pGetMonth, pGetYear;
#endif
int catChar;
unsigned catSector;
char debug; /* turns debug printout on and off */
int sizeLTentry; /* contains size of a logTab entry */
char lastExtern;
} ; /* And that's all of the variables we want to save */
/************************************************************************/
/* Room data */
/************************************************************************/
#define UNREAD 0 /* Only list unread rooms */
#define ALMOST_ALL 1 /* List both unread and read rooms */
#define FORGOT 2 /* List forgotten public rooms */
struct rflags { /* Room flags */
unsigned INUSE : 1; /* Room in use? */
unsigned PUBLIC : 1; /* Room public? */
unsigned MSDOSDIR : 1; /* Room directory? */
unsigned PERMROOM : 1; /* Room permanent? */
unsigned SKIP : 1; /* Room skipped? (temporary for user) */
unsigned YUCK : 0; /* Force realignment I guess. */
} ;
struct rTable { /* The summation of a room */
unsigned char rtgen; /* generation # of room */
struct rflags rtflags; /* public/private flag etc */
label rtname; /* name of room */
ulong rtlastMessage;/* # of most recent message in room */
} ; /* And see ROOMA.C for declaration */
struct aRoom { /* The appearance of a room: */
unsigned char rbgen; /* generation # of room */
struct rflags rbflags; /* same bits as flags above */
label rbname; /* name of room */
char rbdisk; /* disk this rooms files are in 0=>none */
char rbdirname[9]; /* user directory for this room's files */
struct {
ulong rbmsgNo; /* every message gets unique# */
unsigned rbmsgLoc; /* sector message starts in */
} msg[MSGSPERRM];
} ; /* And see ROOMA.C for declaration */
/************************************************************************/
/* userlog stuff */
/************************************************************************/
#define CRYPTADD 117 /* */
struct lflags { /* Flags for person in log */
unsigned UCMASK : 1; /* Uppercase? */
unsigned LFMASK : 1; /* Linefeeds? */
unsigned EXPERT : 1; /* Expert? */
unsigned AIDE : 1; /* Vice-Grand-Poobah? */
unsigned L_INUSE : 1; /* Is this slot in use? */
unsigned TIME : 1; /* Send time to user of msg creation? */
unsigned OLDTOO : 1; /* Print out last oldmessage on <N>ew? */
unsigned NET_PRIVS : 1; /* User have net privileges? */
unsigned RUGGIE : 1; /* Juvenile? Future fun-ness */
unsigned YUCK : 0; /* Force realignment ??? */
} ;
#define MAILSLOTS 58 /* Same as normal room */
#define MAXVISIT 8 /* #visits we remember old newestLo for */
#define MAXGEN 32 /* six bits of generation => 64 of them */
#define FORGET_OFFSET (MAXGEN / 2) /* For forgetting rooms */
#define GENSHIFT 3 /* Where the generation # is */
#define CALLMASK 7 /* For finding last visit */
struct logBuffer { /* The appearance of a user: */
unsigned char lbnulls; /* #nulls, lCase, lFeeds */
struct lflags lbflags; /* UCMASK, LFMASK, EXPERT, AIDE, INUSE */
unsigned char lbwidth; /* terminal width */
char credit; /* Credit for long distance calls */
label lbname; /* caller's name */
label lbpw; /* caller's password */
unsigned char lbgen[MAXROOMS];/* 5 bits gen, 3 bits lastvisit */
ulong lbvisit[MAXVISIT];/* newestLo for this and 3 prev. visits */
unsigned lbslot[MAILSLOTS];/* for private mail */
ulong lbId[MAILSLOTS]; /* for private mail */
} ; /* And see LOG.C for declaration */
struct lTable { /* Summation of a person: */
int ltpwhash; /* hash of password */
int ltnmhash; /* hash of name */
int ltlogSlot; /* location in userlog.buf */
ulong ltnewest; /* last message on last call */
} ; /* And see LOG.C for declaration */
/************************************************************************/
/* terminal stuff */
/************************************************************************/
#define SPECIAL 27 /* <ESC> console escape char */
/************************************************************************/
/* message stuff */
/************************************************************************/
#define MAXTEXT 7500 /* maximum chars in edit buffer */
#define HELD 3
struct msgB { /* This is what a msg looks like */
int Ooops;
char mbtext[MAXTEXT] ; /* buffer text is edited in */
int mbheadChar ; /* start of message */
unsigned mbheadSector; /* start of message */
label mbauth ; /* name of author */
label mbdate ; /* creation date */
label mbtime ; /* creation time */
label mbId ; /* local number of message */
label mboname; /* short human name for origin system */
label mborig ; /* US xxx xxx xxxx style ID */
label mbroom ; /* creation room */
label mbsrcId; /* message ID on system of origin */
label mbto ; /* private message to */
label mbaddr ; /* address of system for net routing */
} ; /* declaration in MSG.C */
/* values for showMess routine */
#define NEWoNLY 0
#define OLDaNDnEW 1
#define OLDoNLY 2
#define GLOBALnEW 3
/************************************************************************/
/* modem stuff */
/************************************************************************/
/* somestuff readfile() and sendfile() like: */
#define LOOPSPERSEC 5000
#define ERRORMAX 10
#define RETRYMAX 10
/* fiddle factor to timeout on no input: */
#define HITIMEOUT 7276 /* processor dependent, see MODEM.C */
#define NEWCARRIER 0x01 /* returned to main prog on login */
#define MODEM 0 /* current user of system is */
#define CONSOLE 1 /* one of these */
/* output XON/XOFF etc flag... */
#define OUTOK 0 /* normal output */
#define OUTPAUSE 1 /* a pause has been requested */
#define OUTNEXT 2 /* quit this message, get the next */
#define OUTSKIP 3 /* stop current process */
#define OUTPARAGRAPH 4 /* skip to next paragraph */
#define IMPERVIOUS 5 /* make current output unstoppable */
#define NEITHER 0 /* don't echo input at all */
#define CALLER 1 /* echo to caller only --passwords etc */
#define BOTH 2 /* echo to caller and console both */
#define NO_ECHO 0 /* Echo input as X's */
#define ECHO 1 /* Echo input (getString()) */
/* stuff for the mini-INTRPreter that drives the modem: */
/* opcodes for the interpreter: */
#define ANDI 1
#define INP 2
#define LOAD 3
#define LOADI 4
#define ORI 5
#define OUTP 6
#define OUTSTRING 7
#define PAUSEI 8
#define RET 9
#define STORE 10
#define XORI 11
#define STOREX 12
#define LOADX 13
#define OPRNUMBER 14
#define TOBDC 15
#define TODEC 16
/* For system calls. */
struct regval {int ax, bx, cx, dx, si, di, ds, es; };
#define STARTUP 1
#define FINISH 2
/************************************************************************/
/* net stuff */
/************************************************************************/
#define ONLY_300 0
#define BOTH_300_1200 1
#define TH_3_12_24 2
#define HANGUP 0
#define NORMAL_MAIL 1
#define R_FILE_REQ 2
#define BAD 0
#define GOOD 1
struct nflags { /* Any and all reasons to call this node*/
unsigned normal_mail : 1;
unsigned in_use : 1;
unsigned room_files : 1;
unsigned realign : 0;
} ;
struct netBuffer {
label netId;
label netName;
struct nflags nbflags;
char baudCode;
} ;
struct netTable {
int ntnmhash;
int ntidhash;
struct nflags ntflags ;
} ;
struct cmd_data { /* Commands for networking */
unsigned char command;
char fields[4][NAMESIZE];
} ;
struct fl_req {
label room;
label roomfile;
char drive;
char path[100];
label filename;
} ;
/************************************************************************/
/* Exit values */
/************************************************************************/
#define SYSOP_EXIT 0
#define TIME_EXIT 1
#define CRASH_EXIT 2
/************************************************************************/
/* Useful psuedo functions */
/************************************************************************/
#define gotCarrier() interpret(cfg.pCarrDetect)
#define onLine() (haveCarrier || onConsole)
/************************************************************************/
/* Call log stuff */
/************************************************************************/
#define BAUD 0
#define L_IN 1
#define L_OUT 2
#define CARRLOSS 3